package cn.luischen;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import static org.junit.Assert.*;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
import org.junit.Rule;
import org.junit.runner.RunWith;
import org.junit.rules.ExpectedException;
import org.junit.Test;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.reflect.Whitebox;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.stubbing.Answer;
import java.lang.reflect.Method;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.TypeReference;
import com.alibaba.fastjson.parser.ParserConfig;
import java.util.Map;
import java.util.List;
import com.unitspirit.runtime.*;

/**
 * The class contains tests for the class cn.luischen.Swagger2.
 *
 * @generatedBy UnitSpirit CreateTemplateTestFile4
 * @version 1.0.9.11 
 */
@PowerMockIgnore({ "javax.management.*" })
@RunWith(PowerMockRunner.class)
@PrepareForTest({ cn.luischen.Swagger2.class })
public class Swagger2_createRestApi_WGTest {
	@Rule
	public ExpectedException unitspirit_thrown = ExpectedException.none();

	/**
	 * 测试方法初始化.
	 * 
	 * @throws Exception 
	 *         if the initialization fails for some reason 
	 *  
	 * @generatedBy UnitSpirit at 2021-12-08 11:01:01
	 */
	@org.junit.Before
	public void setUp() throws Exception {
		try {
			GlobalUnitInit.init();
			MockitoAnnotations.initMocks(this);
			ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

	/**
	 * @date 2021-12-08 11:01:02
	 * @see cn.luischen.Swagger2#createRestApi
	 * @category auto generate by UnitSpirit  
	 * @author UnitSpirit   
	 */
	@Test
	public void test_createRestApi_0113_185940_563_2_00() throws Throwable {

		cn.luischen.Swagger2 unitspirit_fixture = new cn.luischen.Swagger2();
		unitspirit_fixture = PowerMockito.spy(unitspirit_fixture);
		//成员变量设置
		Whitebox.setInternalState(unitspirit_fixture, "swaggerShow",
				JSON.parseObject("true", Boolean.class));

		//返回值定义 
		String result_expected = "{\"documentationType\":{\"mediaType\":{\"parameters\":{},\"subtype\":\"json\",\"type\":\"application\"},\"name\":\"swagger\",\"version\":\"2.0\"},\"enabled\":true,\"groupName\":\"default\"}";

		springfox.documentation.service.ApiInfo mock_result_ApiInfo1 = UnitSpiritGsonUtil
				.getGson()
				.fromJson(
						"{\"contact\":\"Luis chen\",\"description\":\"更多Spring Boot相关文章请关注：https://luischen.com/\",\"termsOfServiceUrl\":\"https://luischen.com/\",\"title\":\"Luis Site Swagger Restful API\",\"version\":\"1.0\"}",
						springfox.documentation.service.ApiInfo.class);

		PowerMockito.doReturn(mock_result_ApiInfo1).when(unitspirit_fixture,
				"apiInfo");

		springfox.documentation.spring.web.plugins.Docket unitspirit_result = unitspirit_fixture
				.createRestApi();
		UnitAssert.assertEquals(result_expected,
				UnitSpiritFastJsonUtil.getJsonString2(unitspirit_result));
	}
  /**
  * @date 2021-12-08 11:01:02
  * @see cn.luischen.Swagger2#createRestApi
  * @category auto generate by UnitSpirit  
  * @author UnitSpirit   
  */
  @Test
  public void test_createRestApi_0220_170540_658_2_00() throws Throwable {
    
cn.luischen.Swagger2 unitspirit_fixture=new  cn.luischen.Swagger2();
    unitspirit_fixture = PowerMockito.spy(unitspirit_fixture);
  //成员变量设置
    Whitebox.setInternalState(unitspirit_fixture,"swaggerShow", JSON.parseObject("true",Boolean.class));


    //返回值定义 
    String result_expected = "{\"documentationType\":{\"mediaType\":{\"parameters\":{},\"subtype\":\"json\",\"type\":\"application\"},\"name\":\"swagger\",\"version\":\"2.0\"},\"enabled\":true,\"groupName\":\"default\"}";

    springfox.documentation.service.ApiInfo mock_result_ApiInfo1 =  UnitSpiritGsonUtil.getGson().fromJson("{\"contact\":\"Luis chen\",\"description\":\"更多Spring Boot相关文章请关注：https://luischen.com/\",\"termsOfServiceUrl\":\"https://luischen.com/\",\"title\":\"Luis Site Swagger Restful API\",\"version\":\"1.0\"}",springfox.documentation.service.ApiInfo.class);

    PowerMockito.doReturn( mock_result_ApiInfo1).when(unitspirit_fixture,"apiInfo");

    springfox.documentation.spring.web.plugins.Docket  unitspirit_result =  unitspirit_fixture.createRestApi();
    UnitAssert.assertEquals(result_expected,UnitSpiritFastJsonUtil.getJsonString2(unitspirit_result));
  }
  /**
  * @date 2021-12-08 11:01:02
  * @see cn.luischen.Swagger2#createRestApi
  * @category auto generate by UnitSpirit  
  * @author UnitSpirit   
  */
  @Test
  public void test_createRestApi_1207_113714_365_1_00() throws Throwable {
    
cn.luischen.Swagger2 unitspirit_fixture=new  cn.luischen.Swagger2();
    unitspirit_fixture = PowerMockito.spy(unitspirit_fixture);
  //成员变量设置
    Whitebox.setInternalState(unitspirit_fixture,"swaggerShow", JSON.parseObject("true",Boolean.class));


    //返回值定义 
    String result_expected = "{\"documentationType\":{\"mediaType\":{\"parameters\":{},\"subtype\":\"json\",\"type\":\"application\"},\"name\":\"swagger\",\"version\":\"2.0\"},\"enabled\":true,\"groupName\":\"default\"}";

    springfox.documentation.service.ApiInfo mock_result_ApiInfo1 =  UnitSpiritGsonUtil.getGson().fromJson("{\"contact\":\"Luis chen\",\"description\":\"更多Spring Boot相关文章请关注：https://luischen.com/\",\"termsOfServiceUrl\":\"https://luischen.com/\",\"title\":\"Luis Site Swagger Restful API\",\"version\":\"1.0\"}",springfox.documentation.service.ApiInfo.class);

    PowerMockito.doReturn( mock_result_ApiInfo1).when(unitspirit_fixture,"apiInfo");

    springfox.documentation.spring.web.plugins.Docket  unitspirit_result =  unitspirit_fixture.createRestApi();
    UnitAssert.assertEquals(result_expected,UnitSpiritFastJsonUtil.getJsonString2(unitspirit_result));
  }
  /**
  * @date 2021-12-08 11:01:02
  * @see cn.luischen.Swagger2#createRestApi
  * @category auto generate by UnitSpirit  
  * @author UnitSpirit   
  */
  @Test
  public void test_createRestApi_1215_114317_704_2_00() throws Throwable {
    
cn.luischen.Swagger2 unitspirit_fixture=new  cn.luischen.Swagger2();
    unitspirit_fixture = PowerMockito.spy(unitspirit_fixture);
  //成员变量设置
    Whitebox.setInternalState(unitspirit_fixture,"swaggerShow", JSON.parseObject("true",Boolean.class));


    //返回值定义 
    String result_expected = "{\"documentationType\":{\"mediaType\":{\"parameters\":{},\"subtype\":\"json\",\"type\":\"application\"},\"name\":\"swagger\",\"version\":\"2.0\"},\"enabled\":true,\"groupName\":\"default\"}";

    springfox.documentation.service.ApiInfo mock_result_ApiInfo1 =  UnitSpiritGsonUtil.getGson().fromJson("{\"contact\":\"Luis chen\",\"description\":\"更多Spring Boot相关文章请关注：https://luischen.com/\",\"termsOfServiceUrl\":\"https://luischen.com/\",\"title\":\"Luis Site Swagger Restful API\",\"version\":\"1.0\"}",springfox.documentation.service.ApiInfo.class);

    PowerMockito.doReturn( mock_result_ApiInfo1).when(unitspirit_fixture,"apiInfo");

    springfox.documentation.spring.web.plugins.Docket  unitspirit_result =  unitspirit_fixture.createRestApi();
    UnitAssert.assertEquals(result_expected,UnitSpiritFastJsonUtil.getJsonString2(unitspirit_result));
  }
  /**
  * @date 2021-12-08 11:01:02
  * @see cn.luischen.Swagger2#createRestApi
  * @category auto generate by UnitSpirit  
  * @author UnitSpirit   
  */
  @Test
  public void test_createRestApi_20210222_200453_542_2_00() throws Throwable {
    
cn.luischen.Swagger2 unitspirit_fixture=new  cn.luischen.Swagger2();
    unitspirit_fixture = PowerMockito.spy(unitspirit_fixture);
  //成员变量设置
    Whitebox.setInternalState(unitspirit_fixture,"swaggerShow", JSON.parseObject("true",Boolean.class));


    //返回值定义 
    String result_expected = "{\"documentationType\":{\"mediaType\":{\"parameters\":{},\"subtype\":\"json\",\"type\":\"application\"},\"name\":\"swagger\",\"version\":\"2.0\"},\"enabled\":true,\"groupName\":\"default\"}";

    springfox.documentation.service.ApiInfo mock_result_ApiInfo1 =  UnitSpiritGsonUtil.getGson().fromJson("{\"contact\":\"Luis chen\",\"description\":\"更多Spring Boot相关文章请关注：https://luischen.com/\",\"termsOfServiceUrl\":\"https://luischen.com/\",\"title\":\"Luis Site Swagger Restful API\",\"version\":\"1.0\"}",springfox.documentation.service.ApiInfo.class);

    PowerMockito.doReturn( mock_result_ApiInfo1).when(unitspirit_fixture,"apiInfo");

    springfox.documentation.spring.web.plugins.Docket  unitspirit_result =  unitspirit_fixture.createRestApi();
    UnitAssert.assertEquals(result_expected,UnitSpiritFastJsonUtil.getJsonString2(unitspirit_result));
  }
}